home *** CD-ROM | disk | FTP | other *** search
- TABLE OF CONTENTS
-
- quantizer/--background--
- quantizer/InitQuantizer
- quantizer/DeleteQuantizer
- quantizer/ResizeQuantizer
- quantizer/Quantize
-
- quantizer/--background-- quantizer/--background--
-
- NAME
- quantizer - Quantizer plugin library for AmigaMesaRTL.
-
- PURPOSE
- This document describes the quantizer interface that AmigaMesaRTL
- expects.
-
- A quantizer has two purposes: to reduce the number of colours to the
- display depth, and to output the quantized buffer to the window. A
- quantizer should support both RGBA and Index mode buffers.
-
- When a new context is created, the quantizer library requested by the
- user is opened using OpenLibrary(). If opened successfully,
- InitQuantizer() is called. Do whatever setup is needed here. If all
- goes well, ResizeQuantizer() will be the next thing to be called. If
- something goes wrong, or the user wants to destroy the context,
- DeleteQuantizer() will be called. You should be prepared to receive a
- DeleteQuantizer() call at any time after InitQuantizer() has been
- called.
-
- All the hard work is done by Quantize(). Here you should do whatever
- is necesary to draw the given buffer to the window. To accomodate
- multiple windows on the same screen on AGA, the user can specify a
- palette index range to which the quantizer should restrict the
- output if in RGBA mode.
-
- See the dl1 quantizer source for an example implementation.
-
- quantizer/InitQuantizer quantizer/InitQuantizer
-
- NAME
- InitQuantizer - Initialize the quantizer.
-
- SYNOPSIS
- result = InitQuantizer(window, mode, numcolours, firstcolour)
- D0 A0 D0 D1 D2
-
- int InitQuantizer(struct Window *, ULONG , ULONG , ULONG);
-
- FUNCTION
- The quantizer is initialized. This will be called only once for a
- context. No, you don't get access to the context itself.
-
- The given window is the window created for the context, and where the
- user is expecing the quantizer to draw the output to. You probably
- want to store away the pointer somewhere, as the quantizer is not
- going to get again.
-
- The mode tells you what format the buffer is going to be in.
- Currently only AMRTL_RGBAMode and AMRTL_IndexMode are supported.
-
- The colour range is the palette index range which the user expects
- the buffer to be quantized to. The palette index range is
- [firstcolour , ... , firstcolour+numcolours-1]
- and can be assumed to be a valid range for the window. So for
- example, if numcolours==128 and firstcolour==16, the quantizer should
- touch only palette entries 16, 17, ..., 127.
-
- If the quantizer is for a truecolour display, it doesn't make much
- sense to take any notice of the colour range values of course.
-
- If the quantizer doesn't support a given mode, failure should be
- signalled by returning 0.
-
- INPUTS
- window - Window associated with the quantizer.
- mode - Buffer format, either AMRTL_RGBAMode or AMRTL_IndexMode.
- numcolours - Number of colours to quantize to.
- firstcolour - Palette index of the start of palette range.
-
- RESULTS
- result - 0 if the quantizer failed to initialize, non-zero otherwise.
-
- BUGS
- None
-
- SEE ALSO
- DeleteQuantizer()
-
- quantizer/DeleteQuantizer quantizer/DeleteQuantizer
-
- NAME
- DeleteQuantizer - Delete the quantizer.
-
- SYNOPSIS
- DeleteQuantizer()
-
- void DeleteQuantizer(void);
-
- FUNCTION
- The quantizer is deleted. This can be called anytime after the
- InitQuantizer() function has been called. This includes the case when
- the quantizer failed to initialize.
-
- This function will be called before the quantizer library is closed.
-
- INPUTS
- None.
-
- RESULTS
- None.
-
- BUGS
- None
-
- SEE ALSO
-
-
- quantizer/ResizeQuantizer quantizer/ResizeQuantizer
-
- NAME
- ResizeQuantizer - Resize the quantizer.
-
- SYNOPSIS
- result = ResizeQuantizer(width, height)
- D0 D0 D1
-
- int ResizeQuantizer(int, int);
-
- FUNCTION
- When the window size is set to a new value, the buffer may resized as
- well. This function is called when the buffer changes size. The given
- size may or may not correspond with the window size.
-
- The width is guaranteed to be a multiple of 16.
-
- ResizeQuantizer() will be called at least once after InitQuantizer()
- is called and before Quantize() is called, unless the quantizer is
- deleted in the meantime.
-
- INPUTS
- width - Width of buffer, a multiple of 16.
- height - Height of buffer.
-
- RESULTS
- result - 0 if the quantizer failed to resize, non-zero otherwise.
-
- BUGS
- None
-
- SEE ALSO
-
-
- quantizer/Quantize quantizer/Quantize
-
- NAME
- Quantize - Quantize and output a buffer.
-
- SYNOPSIS
- result = Quantize(buffer)
- D0 A0
-
- int Quantize(APTR);
-
- FUNCTION
- Using the parameters passed to InitQuantizer() and ResizeQuantizer(),
- the given buffer is quantized and drawn.
-
- If the mode is AMRTL_RGBAMode, the buffer contains height*width*4
- bytes in RGBA order. If the mode is AMRTL_IndexMode, the buffer
- contains height*width bytes where each byte represents an index. The
- indices will have been corrected to start at firstcolour.
-
- The buffer should not be modified in any way by Quantize(), as the
- user may want to read pixels from it, or process it further.
-
- INPUTS
- buffer - Buffer to quantize.
-
- RESULTS
- result - 0 if the quantizer failed to quantize, non-zero otherwise.
-
- BUGS
- None
-
- SEE ALSO
- InitQuantizer(), ResizeQuantizer()
-